import http from "@/utils/http";
/**
 * 加入购物车
 * @param {object} data 添加的购物车商品数据
 * @returns 
 */
export const postMemberCart = (data) => {
    return http({
        url: '/member/cart',
        method: 'post',
        data,
    })
}
/**
 * 获取购物车列表
 */
export const getMemberCart = () => {
    return http({ url: "/member/cart" });
};
/**
 * 修改购物车商品
 * @param {Number} id SKUID
 * @param {Object} data 
 * @returns 
 */
export const putMemberCart = (id, data) => {
    return http({
        url: `/member/cart/${id}`,
        method: 'put',
        data,
    })
}

/**
 * 设置商品全选和取消全选
 * @param {Object} data selected 和 ids (skuId 数组)
 */
export const putMemberCartSelected = (data) => {
    return http({ url: `/member/cart/selected`, data, method: "put" });
};
/**
 * 删除购物车
 * @param {Object} data  删除购物车的 参数 ids-skuId集合 clearAll-是否情况-默认false  clearInvalid-清空无效商品
 * @returns 
 */
export const delMemberCart = (data) => {
    return http({
        url: '/member/cart',
        method: 'delete',
        data
    })
}